<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';

// 来个倒计时
let time = ref(3);
setInterval(() => {
    if (time.value == 0) {
        return;
    }
    time.value--;
}, 1000);

// 三秒后跳转到Home
const router = useRouter(); // 这个要放setTimeout外面
setTimeout(() => {
    router.push('/Home'); // 跳转到Home主页
}, 3000);
</script>

<template>
    <div>
        <h2>没有找到页面{{ $route.path }}：{{ time }}后跳转到首页</h2>
    </div>
</template>

<style scoped>
h2 {
    color: red;
}
</style>